﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.ServiceProcess;
using System.Text;
using System.IO;
using System.Net;
using System.Threading;

namespace hcmsservice
{
    public partial class Service1 : ServiceBase
    {
        private Thread MainThread;

        public Service1()
        {
            InitializeComponent();

            MainThread = new Thread(new ThreadStart(ThreadFunc));
            MainThread.Priority = ThreadPriority.Normal;
        }

        protected override void OnStart(string[] args)
        {
            // TODO: 在此处添加代码以启动服务。
            MainThread.Start();
        }

        protected override void OnStop()
        {
            // TODO: 在此处添加代码以执行停止服务所需的关闭操作。
            MainThread.Abort();
        }


        
        //
        public static void ThreadFunc()
        {
            int i = 0;
            while (true)
            {
                //CreateIndex();
                if (i > 5)
                {
                    //CreateTop();
                    i = 0;
                }
                else
                {
                    i++;
                }
                //暂停5分钟
                System.Threading.Thread.Sleep(300000);
            }
        }

#region 业务逻辑
#endregion

    }
}
